import Vue from "vue";
import VueRouter from "vue-router";
//引入home
import home from "../views/home/index.vue";

//登录、注册页面
import login from "@/views/Login";
import reg from "@/views/reg";


//注册组件
import appGoods from "@/views/appGoods";
import appOrders from "@/views/appOrders";
import appShops from "@/views/appShops";
import appUsers from "@/views/appUsers";


Vue.use(VueRouter);

const routes = [
  {
    path: "/reg",
    name: "reg",
    component: reg,
  },
  {
    path: "/login",
    name: "login",
    component: login,
  },
  {
    path: "/home",
    name: "home",
    component: home,
    children: [
      {
        path: "goods",
        name: "goods",
        component: appGoods
      },
      {
        path: "orders",
        name: "orders",
        component: appOrders
      },
      {
        path: "shops",
        name: "shops",
        component: appShops
      },
      {
        path: "users",
        name: "users",
        component: appUsers
      },

    ]
  },

];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes
});

export default router;
